import { Module } from '@nestjs/common';
import { JwtModule } from '@nestjs/jwt';
import { SequelizeModule } from '@nestjs/sequelize';
import { DatabaseModule } from 'src/database/database.module';
import { AccountModule } from '../account/account.module';
import { jwtConstants } from '../auth/constants';
import { RoleController } from './controller/role.controller';
import { RoleEntity } from './entity/role.entity';
import { RoleProviders } from './providers/role.providers';
import { RoleService } from './service/role.service';

@Module({
  controllers: [RoleController],
  imports: [
    DatabaseModule,
    JwtModule.register({
      secret: jwtConstants.secret,
      signOptions: { expiresIn: jwtConstants.expiresSecond }, // token 过期时效
    }),
    SequelizeModule.forFeature([RoleEntity]),
    AccountModule,
  ],
  providers: [RoleService, ...RoleProviders],
})
export class RoleModule {}
